feat: add mcp_lazy mode for on-demand MCP tool loading#8771
feat: add mcp_lazy mode for on-demand MCP tool loading#8771xHeaven wants to merge 7 commits intoanomalyco:devfrom
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
|
#8177 also proposes something similar |
Damn, I completely missed that one. Our solutions differ a bit, I guess it comes down to preference. Also, honestly, I'm not sure I'd call either solution "complete", more like an idea of how this feature could be implemented. |
|
There was also this one in November that was closed, #4717 Slightly different and with the idea of loading tools for certain turns and then unloading them |
|
yeah #4717 was a simpler implementation that just worked, maybe not the most feature full approach but did the trick fine. I closed it because it wasn't getting any attention and i wanted to help declutter opencode's growing PR number :D |
That's probably what's going to happen to this PR, too. This is a great feature - probably not the best implementation -, but it's not getting the attention I would expect for something like this. I'm hoping the core contributors will pick up on it and make a better implementation. |
|
There's another proposed implementation here https://github.com/famitzsy8/opencode-tool-search-tool By @famitzsy8 If we are going to keep pushing this idea forward we might need to consolidate all the duplicate issues and PRs. |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
Closes #8625.
What does this PR do?
Adds a new
experimental.mcp_lazyconfig option that prevents MCP tools from being loaded into context automatically. Instead, a newmcp_searchtool is provided to discover and call MCP tools on-demand.This reduces context usage for users with many MCP servers configured. When enabled:
mcp_searchtool allows listing, searching, describing, and calling MCP tools/mcpdialogThe injected prompt:
How did you verify your code works?
experimental.mcp_lazy: truein configmcp_searchappears insteadThe tests were manual, there are no actual tests included here.